package org.applesline.desensitize.handle.impl;

import org.applesline.desensitize.constants.DesensitizeType;
import org.applesline.desensitize.handle.DesensitizeAdapter;
import org.springframework.stereotype.Component;

/**
 * @author liuyaping
 * @date 2022/1/13
 */
@Component
public class PasswordHandler extends DesensitizeAdapter {

    @Override
    public String doMask(String password) {
        return isBlank(password) ? "" : repeat('*', password.length());
    }

    @Override
    public DesensitizeType getFieldType() {
        return DesensitizeType.PASSWORD;
    }
}
